<template>
	<uni-icons @click="uniShare" :color="color" type="redo" size="30"></uni-icons>

</template>
<script>
	import UniShare from 'uni_modules/uni-share/js_sdk/uni-share.js';
	const uniShare = new UniShare();
	export default {
		props: {
			color: {
				type: String,
				default: '#ffffff'
			},
			// 传入公司链接
			url: {
				type: String,
				default: ''
			},
			//  详情标题
			detailTitle:{
				type: String,
				default: ''
			}
		},
		onBackPress({
			from
		}) {
			console.log(from);
			if (from == 'backbutton') {
				this.$nextTick(function() {
					uniShare.hide()
				})
				return uniShare.isShow;
			}
		},

		beforeDestroy() {
			// console.log("这里是销毁之前url",this.url)
		},
		methods: {
			uniShare() {
				

				console.log("这里是app 的 url+++++++++++",this.url)
				uniShare.show({
					content: { //公共的分享参数配置  类型（type）、链接（herf）、标题（title）、summary（描述）、imageUrl（缩略图）
						type: 0,
						href: 'http://www.caineng.com/zhaobiao/index.html',
						title: this.detailTitle?this.detailTitle:'才能招标',
						summary: '全面的招标信息，详尽的企业详情，尽在才能招标',
						imageUrl: 'https://cainengcom.oss-cn-beijing.aliyuncs.com/zhaobiao/logo/%E6%8B%9B%E6%A0%87%E5%9B%BE%E7%89%87.jpg'
						// imageUrl:'/static/images/share.jpg'
					},
					menus: [
						/* {
							"img": "/static/app-plus/sharemenu/wechatfriend.png",
							"text": "微信好友",
							"share": { //当前项的分享参数配置。可覆盖公共的配置如下：分享到微信小程序，配置了type=5
								"provider": "weixin",
								"scene": "WXSceneSession"
							}
						}, */
						{
							"img": "/static/app-plus/sharemenu/wechatmoments.png",
							"text": "微信朋友圈",
							"share": {
								"provider": "weixin",
								"scene": "WXSceneTimeline",
								miniProgram: {
									id: 'gh_cb35539e23e4',
									// 'pagesIndex/detailshare' this.url?this.url:'pages/index/index' 'pagesIndex/detail?id=1_43_0744_63c0cdb80deab8fbac5e2744'
									path: this.url ? this.url : 'pages/index/index',
									webUrl: '/#/pages/index/index',
									type: 0
								}
							}
						},
						{
							"img": "/static/app-plus/sharemenu/wechatfriend.png",
							"text": "微信好友",
							"share": {
								provider: "weixin",
								scene: "WXSceneSession",
								type: 5,
								miniProgram: {
									id: 'gh_cb35539e23e4',
									// 'pagesIndex/detailshare' this.url?this.url:'pages/index/index' 'pagesIndex/detail?id=1_43_0744_63c0cdb80deab8fbac5e2744'
									path: this.url ? this.url : 'pages/index/index',
									webUrl: '/#/pages/index/index',
									type: 0
								},
							}
						},
						{
							"img": "/static/app-plus/sharemenu/weibo.png",
							"text": "微博",
							"share": {
								"provider": "sinaweibo"
							}
						},
						{
							"img": "/static/app-plus/sharemenu/qq.png",
							"text": "QQ",
							"share": {
								"provider": "qq"
							}
						},
						{
							"img": "/static/app-plus/sharemenu/copyurl.png",
							"text": "复制",
							"share": "copyurl"
						},
						{
							"img": "/static/app-plus/sharemenu/more.png",
							"text": "更多",
							"share": "shareSystem"
						}
					],
					cancelText: "取消分享",
				}, e => { //callback
					console.log(uniShare.isShow);
					console.log(e);
					// console.log("this.url000000000000000000",this.url)
				})




			}
		}
	}
</script>
